<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文本框文字转移示例</title>
    <style>
        /* 简单的样式来美化文本框和按钮 */
        .textbox {
            width: 200px;
            padding: 10px;
            margin: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .button {
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            background-color: #28a745;
            color: #fff;
            cursor: pointer;
        }
        .button:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>
    <div>
        <label for="sourceText">源文本框:</label>
        <input type="text" id="sourceText" class="textbox">
    </div>
    <div>
        <button id="transferButton" class="button">转移到目标文本框</button>
    </div>
    <div>
        <label for="targetText">目标文本框:</label>
        <input type="text" id="targetText" class="textbox">
    </div>
    <script>
        // 获取文本框和按钮的引用
        const sourceText = document.getElementById('sourceText');
        const targetText = document.getElementById('targetText');
        const transferButton = document.getElementById('transferButton');
        // 为按钮添加点击事件监听器
        transferButton.addEventListener('click', function() {
            // 将源文本框的内容添加到目标文本框的末尾
            targetText.value += sourceText.value;
            // 可选：清空源文本框（如果你想在转移后清空它）
            sourceText.value = '';
        });
    </script>
</body>
</html>